<?php

$params = require(__DIR__ . '/params.php');

return [
    'id' => 'app-frontend',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'frontend\controllers',
    'defaultRoute' => 'index/index',
    'components' => [
        'db' =>[
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=10.46.178.239;dbname=yii_hw',
            'username' => 'root',
            'password' => 'root',
            'charset' => 'utf8',
            'tablePrefix' => 'dh_',
            'enableSchemaCache' => false,
            'slaves' => [
                ['dsn' => 'mysql:host=10.46.178.239;dbname=yii_hw'],
            ],

            'slaveConfig' => [
                'username' => 'root',
                'password' => 'root',
                'charset' => 'utf8',
                'tablePrefix' => 'dh_',
            ]
        ],
        'user' => [
            'identityClass' => 'app\models\SysUsers',
            'enableAutoLogin' => true,
            'loginUrl' => ['user/login'],  
        ],
        'request' => [
  //          'cookieValidationKey' => '51dh',
        	'enableCsrfValidation' => false,
//         	'enableCookieValidation' => false,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'error/error',
            
        ],
        'urlManager' => ['enablePrettyUrl' => true,
            'showScriptName' => false,],
    ],
    'params' => $params,
];
